package com.example.caorl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

@Component
public class Klass {

    public static Student staticStudent;

    @Autowired
    private Student student1;

    @Autowired
    @Qualifier( "student2" )
    private Student student2;

    @Resource(name = "student3")
    private Student student3;

    @PostConstruct
    public void init() {
        staticStudent = student1;
        System.out.println("静态注入成功===========");
    }

    public void print() {
        student1.print();
        student2.print();
        student3.print();
    }
}
